<template>
  <el-row :gutter="30">
    <el-col :span="3"
            :class="type == 'sender' ? 'from' : 'to'">
      <icon-svg class-name="iconClass"
                :icon-name="type == 'sender' ? 'qi1' : 'zhong1'" />
      <!-- <span>{{type=='sender'?'发':'收'}}</span> -->
    </el-col>
    <el-col :span="20"
            style="padding-left: 0">
      <!-- {{info}} -->
      <ul>
        <li class="person0">
          <span :title="`${info.province} ${info.city} ${info.district}`"
                class="ellipsis-1">{{ info.province }}{{ info.city }}{{ info.district }}</span>
          <br />
          <span :title="info.address"
                class="ellipsis-2">{{
            info.address
          }}</span>
        </li>
        <li class="c-grey">
          <span :title="company"
                class="ellipsis-1">{{ company }}</span>
        </li>
        <li class="c-grey">
          {{ info.contactName }}
          <span class="ml20 mr20">{{ info.contactMobile }}</span>
        </li>
        <li class="c-grey">
          <span v-if="fromTime || toTime">{{type == "sender" ?  $moment(fromTime).format("YYYY-MM-DD HH:mm") :  $moment(toTime).format("YYYY-MM-DD HH:mm") }}</span>
        </li>
      </ul>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: "Descriptions",
  props: {
    info: {
      type: Object,
      default: () => {
        return {
          address: "",
          cityCode: "",
          contactName: "",
          districtCode: "",
          provinceCode: ""
        };
      }
    },
    fromTime: {
      type: String,
      value: ""
    },
    toTime: {
      type: String,
      value: ""
    },
    type: {
      type: String,
      value: "sender"
    },
    company: {
      type: String,
      value: ""
    }
  }
};
</script>

<style lang="scss" scoped>
ul {
  padding: 0;
  list-style: none;
  li {
    margin-top: 10px;
  }
}
.from {
  margin-top: 12px;
  text-align: right;
  > span {
    display: inline-block;
    padding: 5px 6px;
    border-radius: 50%;
    font-size: 16px;
    color: var(--prev-bg-white);
    background-color: #2aa239;
  }
}
.to {
  margin-top: 12px;
  text-align: right;
  > span {
    display: inline-block;
    padding: 5px 6px;
    border-radius: 50%;
    font-size: 16px;
    color: var(--prev-bg-white);
    background-color: #e52914;
  }
}
.person0 {
  font-size: 16px;
  font-weight: bold;
  line-height: 24px;
}
.iconClass {
  font-size: 32px;
  position: relative;
  top: 5px;
}
.ellipsis-1 {
  width: 310px;
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.ellipsis-2 {
  width: 310px;
  display: -webkit-box;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
</style>
